package com.quickthumb.game;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.Log;

public class TrapFish extends Trap{
	public static final int power = 10;

	@Override
	public void update() {

		Rat r = null;
		// check rat with same position
		int bucketSize=Screen.bucket.size();
		int trapssize=Screen.ActiveTraps.size();
		for (int i = 0; i < Screen.bucket.size(); i++) {
			if (((r = Screen.bucket.get(i)).position == position)
					&& r.isAlive()) {
				if (r.getPower() <= power) {
					
					Player.huntedRats.add(r);
					Screen.bucket.remove(i);
					Log.d("block", "get rate" + " " + r.percent()+" "+bucketSize+" "+Screen.bucket.size());
				}
				// remove my self from activeblocks
				for (int j = 0; j < Screen.ActiveTraps.size(); j++) {
					if (Screen.ActiveTraps.get(j).position == position) {
						Screen.ActiveTraps.remove(j);
					}
				}
			}
		}
	}

	@Override
	public void draw(Canvas c, Paint p) {

		p.setColor(Color.BLUE);
		c.drawCircle(position % Screen.HOLES_W, position / Screen.HOLES_W,
				0.2f, p);
	}
	
}
